package enumdemo;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;


public class Constant {
    public static final int RED = 1;
    public static final int WHITE = 2;
    public static final int GREEN = 3;


    public static void main(String[] args) throws ClassNotFoundException {

        Class<?> c = Class.forName("enumdemo.TestEnum");


        try {
            Constructor<?> constructor
                    = c.getDeclaredConstructor(String.class,int.class,int.class,String.class);
            constructor.setAccessible(true);

            TestEnum testEnum
                    = (TestEnum)constructor.newInstance("ceshi",999,99,"hello");

            System.out.println(testEnum);

        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
}
